<template>
    <div class="qingwu">
        <div class="admin_table_page_title">
            <a-button @click="$router.back()" class="float_right" icon="arrow-left">返回</a-button>
            公司及联系人信息
        </div>
        <div class="unline underm"></div>
        <div class="admin_form">
            <a-form-model :label-col="{ span: 6 }" :wrapper-col="{ span: 12 }" >
                <a-form-model-item label="物业名称">
                    <a-input v-model="info.name" ></a-input>
                </a-form-model-item>

                <a-form-model-item label="登陆账号">
                    <a-input v-model="info.account"></a-input>
                </a-form-model-item>

                <!--<a-form-model-item label="登陆密码">-->
                    <!--<a-input type="password" placeholder="不修改密码请留空" v-model="info.password"></a-input>-->
                <!--</a-form-model-item>-->

                <a-form-model-item label="企业详细地址">
                    <a-input v-model="info.address"></a-input>
                </a-form-model-item>

                <a-form-model-item label="负责人">
                    <a-input v-model="info.principal"></a-input>
                </a-form-model-item>

                <a-form-model-item label="负责人联系电话">
                    <a-input v-model="info.principal_mobile"></a-input>
                </a-form-model-item>

                <a-form-model-item :wrapper-col="{ span: 12, offset: 5 }">
                    <a-button type="primary" @click="handleSubmit">提交</a-button>
                </a-form-model-item>
            </a-form-model>
        </div>
    </div>
</template>

<script>
export default {
    components: {},
    props: {},
    data() {
        return {
            info:{
            },
            id:0,
            options: [],
            areas:[],
            ModalText: 'Content of the modal',
            visible: false,
            confirmLoading: false,
            reason_rejection:''
        };
    },
    watch: {},
    computed: {},
    methods: {
        showModal() {
            this.visible = true;
        },
        handleSubmit(){
            let api = this.$apiHandle(this.$api.adminProperty,this.id);

            this.$put(api.url,this.info).then(res=>{
                if(res.code == 200){
                    this.$message.success(res.msg)
                    return this.$router.back();
                }else{
                    return this.$message.error(res.msg)
                }
            })
        },
        get_info(){
            this.$get(this.$api.adminProperty +'/' + this.id + '/edit').then(res=>{
                this.info = res.data;

                this.info.password = null;
            })
        },
        handleOk(e) {
            this.confirmLoading = true;

            this.$post(this.$api.editPropertyCheck,{id:this.id , property_id:this.info.id , check:'false' , reason_rejection : this.reason_rejection}).then(res=>{
                if(res.code == 200){
                    this.$message.success(res.msg)
                    return this.$router.back();
                }else{
                    return this.$message.error(res.msg)
                }
            })

            this.confirmLoading = false;
        },
        handleCancel(e) {
            this.visible = false;
        },
    },
    created() {
        this.id = this.$route.params.id;
        this.get_info();
    },
    mounted() {}
};
</script>
<style lang="scss" scoped>

</style>
